package com.zhao.message.srv;

import com.alibaba.dubbo.config.annotation.Reference;
import com.zhao.message.api.MessageFeignService;
import com.zhao.query.api.QueryDubboService;
import com.zhao.query.api.QueryFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created on 2019/7/22.
 *
 * @author zhao
 * @email 136689260@qq.com
 */
@RestController
public class MessageController implements MessageFeignService {

    @Autowired
    private QueryFeignService queryFeignService;

    @Reference(lazy = true, check = false)
    private QueryDubboService queryDubboService;

    @RequestMapping("/queryFeign/{message}")
    public String queryFeign(@PathVariable("message") String message) {
        return queryFeignService.queryFeign(message);
    }

    @RequestMapping("/queryDubbo/{message}")
    public String queryDubbo(@PathVariable("message") String message) {
        return queryDubboService.queryDubbo(message);
    }

    @Override
    public String messageFeign(String message) {
        return "messageFeign message is" + message;
    }
}
